package andenginetry;

import com.andengine.editor.atlaseditor.TextureAtlasEditorPanel;
import com.andengine.editor.sceneeditor.SceneEditorPanel;
import com.andengine.editor.textureregioneditor.TextureRegionEditorPanel;
import java.awt.Point;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author sad
 */
public class AndEngineTry {

    private static void setWindowsLookAndFeel() {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            JPopupMenu.setDefaultLightWeightPopupEnabled(false);
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            Logger.getLogger(AndEngineTry.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static void main(String[] args) {
        setWindowsLookAndFeel();
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                TextureAtlasEditorPanel panel = new TextureAtlasEditorPanel();
                JFrame frame = new JFrame("Texture Atlas Editor");
                frame.getContentPane().add(panel);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
                
                TextureRegionEditorPanel panel2 = new TextureRegionEditorPanel();
                JFrame frame2 = new JFrame("Sprite Editor");
                frame2.getContentPane().add(panel2);
                frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame2.pack();
                frame2.setLocationRelativeTo(null);
                frame2.setVisible(true);
                Point p = frame2.getLocation();
                p.setLocation(20 + p.getX(), 20 + p.getY());
                frame2.setLocation(p);
                
                SceneEditorPanel panel3=null;
                try {
                    panel3 = new SceneEditorPanel();
                } catch (IOException ex) {
                    throw new RuntimeException(ex);
                }
                JFrame frame3 = new JFrame("Scene Editor");
                frame3.getContentPane().add(panel3);
                frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame3.pack();
                frame3.setLocationRelativeTo(null);
                frame3.setVisible(true);
                Point p2 = frame3.getLocation();
                p2.setLocation(20 + p.getX(), 20 + p.getY());
                frame3.setLocation(p2);
                
                
            }
        });
    }

}
